// written by Jonathan Odom and Aneesh Butani

#include "Day.h"

//const string Day::YES = "yes";
//const string Day::NO = "no";
const string Day::FREE = "&nbsp;";

Day::Day()
{
}

Day::Day(const vector<Event>& events, bool allDay)
: myEvents(events)
//,allDayEvent(allDay)
{
}

vector<string> Day::dayList(){
	vector<string> list;
	int hour = 0;
	for (vector<Event>::iterator it = myEvents.begin(); it!=myEvents.end(); ++it) {
		while(int(it->Event::getStart()) > hour){
			list.push_back(FREE);
			hour++;
		}
		while(int(it->Event::getEnd()) > hour){
			vector<Event>::iterator iterTemp = it;
			++iterTemp;
			if(iterTemp!=myEvents.end()){
				if(int(iterTemp->Event::getStart()) <= hour)
					list.push_back(it->Event::getDescription() + ", " + iterTemp->Event::getDescription());
				else
					list.push_back(it->Event::getDescription());
			}
			else
				list.push_back(it->Event::getDescription());
			hour++;
		}
	}
	while(hour<24){
		list.push_back(FREE);
		hour++;
	}
	//if(allDayEvent)
	//	list.push_back(YES);
	//else
	//	list.push_back(NO);
	return list;
}
Day::~Day()
{
}
